from django.contrib import admin

# Register your models here.

from apps.UploadFile.models import *


"""
创建管理员用户：
在Terminal中：
python manage.py createsuperuser
回车之后分别输入 账号 邮箱 密码（密码输入时是看不到的）然后输入y确定
如果密码忘了：
打开数据库，找到auth_user即可查看 修改。

账号：admin
密码：admin

"""


# 文本admin
@admin.register(Text_uploadModel)
class Text_uploadModelAdmin(admin.ModelAdmin):

    list_display = ["username","time","information","ip"] #要显示的字段
    search_fields = ["information","ip"] #查询字段
    list_filter = ["username","ip"] #过滤查询
    list_per_page = 3 #分页


    def __str__(self):
        # 在表中显示数据
        return self.information


# 图片admin
@admin.register(Imgs_uploadModel)
class Imgs_uploadModelAdmin(admin.ModelAdmin):

    list_display = ["username","time","image","image_name","ip"] #要显示的字段
    search_fields = ["image_name","ip","username"] #查询字段
    list_filter = ["username","ip"] #过滤查询
    list_per_page = 3 #分页


    def __str__(self):
        # 在表中显示数据
        return self.username